<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="陈嘉乐">
    <title></title>
    <style>
 div{
			width: 300px;
			margin: 0 auto;
			background-color: #333;
			padding: 5px;
			color: white;
			text-align: center;
		}
		span{
			display: inline-block;
			padding: 0 10px;
			margin: 0 10px;
			border: 2px solid #999;
			background-color: #fff;
			color: #000;
		}
        button{
            margin: 10px;
        }

    </style>
</head>

<body>
    <div>


        <p>
            <span>02</span>分
            <span>59</span>秒
        </p>
        <button type="button" onclick="start()">开始倒计时<tton>
	</div>


   </div>
</body>
</html>
<script>  
var spans = document.querySelectorAll('span');
var button=document.querySelector('button');
  function start() {
      if (spans[1].innerHTML>0) {
          spans[1].innerHTML--;
      } else if (spans[0].innerHTML>0) {
          spans[0].innerHTML--;
          spans[1].innerHTML=59;
      } else{
          clearInterval(timer);
      }
          
  }
  var timer = setInterval(start,1000);
</script>